<template>
	<u-sticky bg-color="#F9F9F9" h5-nav-height="0">
		<u-tabs active-color="#117B12" :list="tabsList" :is-scroll="false" v-model="tabsCurrent" @change="tabsChange"
			:font-size="28"></u-tabs>
	</u-sticky>
	<u-gap height="20"></u-gap>
	<view class="u-p-l-20 u-p-r-20" v-for="v in list">
		<view class="bgw box-radius u-p-28 u-font-24">
			<view class="u-flex u-m-b-15 u-font-28">
				<view class="u-flex-1">
					<!-- 0=分享佣金,1=分红佣金,2=佣金提现,3=佣金转积分,4=后台变更 -->
					{{v.commissionStatus == 0 ?'分享佣金':v.commissionStatus == 1 ?'分红佣金':v.commissionStatus == 2 ?'佣金提现':v.commissionStatus == 3 ?'佣金转积分':v.commissionStatus == 4 ?'后台变更':'-'}}
				</view>
				<view class="color-green" v-if="v.type == 0">
					+{{v.total}}
				</view>
				<view class="color-red" v-if="v.type == 1">
					-{{v.total}}
				</view>
			</view>
			<!-- <view class="u-p-b-10 u-content-color">
				订单编号：5648724517852
			</view> -->
			<view class="u-p-b-10 u-content-color" v-if="v.commissionStatus == 0">
				来源：{{v.phone}}
			</view>
			<view class="u-p-b-10 u-content-color">
				变动前佣金：{{v.beforeCommission}}
			</view>
			<view class="u-p-b-10 u-content-color">
				变动后佣金：{{v.afterCommission}}
			</view>
			<view class="u-content-color">
				变动时间：{{v.created}}
			</view>
		</view>
		<u-gap height="20"></u-gap>
	</view>
	<g-loadmore :status="loadmoreStatus"></g-loadmore>
	<u-gap height="20"></u-gap>
</template>
<script setup>
	import mixins from '@/common/js/mixins.js';
	import mixinList from '@/common/js/mixinList.js';
	import store from '@/store/index.js'; //需要引入store
	import {
		ref,
		reactive,
		computed,
		getCurrentInstance,
		watch
	} from 'vue'
	import {
		onReady,
		onLoad,
		onShow
	} from '@dcloudio/uni-app'
	const {
		proxy,
	} = getCurrentInstance()
	const {
		nav,
		navLogin
	} = proxy.$util;
	const {
		total,
		current_page,
		page_size,
		last_page,
		apiPath,
		loading,
		list,
		searchParams,
		getList,
		getNextList,
		loadmoreStatus,
		searchClear,
		searchConfirm
	} = mixinList();
	const props = defineProps({
		type: {
			type: [String, Number],
			default: '',
		}
	})
	const tabsCurrent = ref(0)
	const tabsList = [
		// {
		// 	name: '全部',
		// 	id: 2
		// },
		{
			name: '分享佣金',
			id: 0
		},
		{
			name: '分红佣金',
			id: 1
		},
	];
	if(props.type){
		if(props.type == 0){
			tabsCurrent.value = 0
		}
		if(props.type == 1){
			tabsCurrent.value = 1
		}
	}
	const tabsChange = (index) => {}
	watch(tabsCurrent, async (val) => {
		await getList(1)
	})
	apiPath.value = 'getCommissionMe'
	searchParams.commissionStatus = computed(() => {
		return tabsList[tabsCurrent.value].id
	});
	const statisticsData = ref({})

	// const bindStatusChange = () => {}
	onReady(() => {

	})
	onLoad((d) => {
		getList(1)
	})
	onShow(() => {

	})
</script>

<style lang="scss" scoped>

</style>